<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 定义类
    class Person {
      // 实现构造函数里面定义属性
      constructor (theName, theAge) {
        this.name = theName;
        this.age = theAge;
      }
      // 定义方法
      sayHello () {
        console.log('你好啊,我是顿健康');
      }
    }
    class Boy extends Person{
      constructor (theHeight, tName, tAge) {
        super(tName, tAge) //必须调用父级(在使用extends时)
        this.height = theHeight
      }
      run () {
        console.log('赶紧跑');
      }
    }
    var boy1 = new Boy(185, '小明', 19)
    console.log(boy1)
  </script>
</body>
</html>